{	Problem: http://codeforces.ru/problemset/problem/71/C
	Verdict: Accepted
}
var a:array[1..200010] of boolean; i,j,n,k:longint; f:boolean;
begin
read(n);
fillchar(a,sizeof(a),false);
for i:=1 to n do begin
    read(k);
    if k=1 then begin
        a[i]:=true;
        a[n+i]:=true;
    end;
end;
f:=false;
for i:=1 to n do begin
    if a[i] then
        for j:=1 to n do
            if (n mod j=0) and (n div j>2) then begin
                k:=j;
                while a[i+k] and (k<>n) do inc(k,j);
                if k=n then begin
                    f:=true;
                    break;
                end;
            end;
    if f then break;
end;
if f then write('YES') else write('NO');
end.